package com.SMP.service.class_room;

import com.SMP.dao.GradeclassMapper;
import com.SMP.model.Gradeclass;
import com.SMP.utils.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GradeClassService {

    @Autowired
    GradeclassMapper gradeclassMapper;

    /**
     * 增加班级
     * @author WYHY
     * @param gradeclass 班级
     *
     * */
    public int addGC(Gradeclass gradeclass){
        int result=0;
        gradeclass.setId(Utils.getsUUID());
        result=gradeclassMapper.insert(gradeclass);
        return result;
    }

    /**
     * 删除年级
     * @author WYHY
     * @param grade 班级
     *
     * */
    public int delG(String grade){
        int result=0;
        result=gradeclassMapper.deleteByGrade(grade);
        return result;
    }

    /**
     * 删除班级
     * @author WYHY
     * @param id 班级
     *
     * */
    public int delC(String id){
        int result=0;
        result=gradeclassMapper.deleteByPrimaryKey(id);
        return result;
    }

    /**
     * 查询年级
     * @author WYHY
     * @param
     *
     * */
    public List<Gradeclass> selGrade(){
        List<Gradeclass> result=gradeclassMapper.selGrade();
        return result;
    }

    /**
     * 查询班级
     * @author WYHY
     * @param
     *
     * */
    public List<Gradeclass> selClass(String grade){
        List<Gradeclass> result=gradeclassMapper.selectClass(grade);
        return result;
    }

}
